package com.vader.boot.scope;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import javax.annotation.PreDestroy;

/**
 * @author Vader
 * @date 2022/5/24
 **/
@Component
public class BeanForSingleton {

    @Lazy
    @Autowired
    private BeanForPrototype property;

    public BeanForPrototype getProperty() {
        return property;
    }

    @PreDestroy
    public void destroy() {
        System.out.println("BeanForSingleton_destroy:" + this);
    }
}
